package licode.unisop.single.platform.application.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * PlatAssetPropEntity
 * 
 * @author licode
 * @date 2016-08-27 15:30:59 
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PlatAssetPropEntity implements Serializable {

    private static final long serialVersionUID =  970011195891653777L;

    private String id;

    /**
     * 领域标识
     */
    private String realmId;

    /**
     * 平台标识
     */
    private String platformId;

    /**
     * 资源标识
     */
    private String assetId;

    /**
     * 资源类型
     */
    private String assetType;

    /**
     * 参数名称
     */
    private String name;

    /**
     * 参数long类型的值
     */
    private Long vI;

    /**
     * 参数double类型值
     */
    private Double vD;

    /**
     * 参数JSON字符串值
     */
    private String vJ;

    public boolean isEmpty() {
        return (vI == null && vD == null && vJ == null);
    }

    public Object getValidValue() {
        return (vJ != null ? vJ : (vI != null ? vI : vD));
    }
}
